
include(CMakeFindDependencyMacro)

set(MSDFGEN_CORE_ONLY @MSDFGEN_CORE_ONLY@)
set(MSDFGEN_USE_VCPKG @MSDFGEN_USE_VCPKG@)
set(MSDFGEN_USE_OPENMP @MSDFGEN_USE_OPENMP@)
set(MSDFGEN_USE_SKIA @MSDFGEN_USE_SKIA@)
set(MSDFGEN_STANDALONE_AVAILABLE @MSDFGEN_BUILD_STANDALONE@)

if(NOT MSDFGEN_CORE_ONLY)
    find_dependency(Freetype REQUIRED)
    find_dependency(tinyxml2 REQUIRED)
    find_dependency(PNG REQUIRED)
endif()
if(MSDFGEN_USE_SKIA)
    find_dependency(Threads REQUIRED)
    if(MSDFGEN_USE_VCPKG)
        find_dependency(unofficial-skia REQUIRED)
    else()
        find_dependency(skia REQUIRED)
    endif()
endif()
if(MSDFGEN_USE_OPENMP)
    find_dependency(OpenMP REQUIRED COMPONENTS CXX)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/msdfgenTargets.cmake")

if(MSDFGEN_CORE_ONLY)
    if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
        set_target_properties(msdfgen::msdfgen-core PROPERTIES IMPORTED_GLOBAL TRUE)
    endif()
    add_library(msdfgen::msdfgen ALIAS msdfgen::msdfgen-core)
else()
    if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
        set_target_properties(msdfgen::msdfgen-full PROPERTIES IMPORTED_GLOBAL TRUE)
    endif()
    add_library(msdfgen::msdfgen ALIAS msdfgen::msdfgen-full)
endif()

if(MSDFGEN_STANDALONE_AVAILABLE)
    include("${CMAKE_CURRENT_LIST_DIR}/msdfgenBinaryTargets.cmake")
    if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
        set_target_properties(msdfgen-standalone::msdfgen PROPERTIES IMPORTED_GLOBAL TRUE)
    endif()
    add_executable(msdfgen::msdfgen-run ALIAS msdfgen-standalone::msdfgen)
    set(MSDFGEN_EXECUTABLE "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/msdfgen@CMAKE_EXECUTABLE_SUFFIX@")
endif()
